package IO;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class InputStreamReaderTest {
    public static void main(String[] args) throws IOException {
        //test.txt采用UTF-8编码
        InputStreamReader reader = new InputStreamReader(
                new FileInputStream("/Users/zhang/Documents/doc/test.txt"), "UTF-8");
        int data;
        while ((data = reader.read()) != -1) {
            System.out.print((char) data);
        }
        reader.close();
    }
}
